/*
 * @Description:
 * @Date: 2023-03-06 17:15:38
 * @LastEditors: czp
 * @LastEditTime: 2023-04-21 09:34:42
 */

export const useComponents = (compNames: string[], page: string) => {
	const modules = import.meta.glob<any>(`~V/*/components/*.vue`);

	const mapComponents: Record<string, any> = {};

	compNames.map(item => {
		mapComponents[item] = defineAsyncComponent(modules[`/src/views/${page}/components/${item}.vue`]);
		// mapComponents[item] = defineComponent(modules[`/src/views/${page}/components/${item}.vue`]);
	});

	return mapComponents;
};
